﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Threading;
using System.Runtime.Remoting.Messaging;

namespace TheardLearnWeb.Learn
{
    public partial class ExecuteContext : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Execute();
        }

        public void Execute()
        {
            CallContext.LogicalSetData("Name", "Jeffrey");
            ThreadPool.QueueUserWorkItem(state => this.divContent.InnerHtml += string.Format("name={0}</br>", CallContext.LogicalGetData("Name")));

            ExecutionContext.SuppressFlow();

            ThreadPool.QueueUserWorkItem(state => this.divContent.InnerHtml += string.Format("name={0}</br>", CallContext.LogicalGetData("Name")));

            ExecutionContext.RestoreFlow();
            CallContext.LogicalSetData("Major", "Computer");
            ThreadPool.QueueUserWorkItem(state => this.divContent.InnerHtml += string.Format("Major={0}</br>", CallContext.LogicalGetData("Major")));

        }
    }
}